Repository navigation
fix: gate Programs dashboard routes on program_management (EN-245) - #1301
Conversation
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
carddev81
left a comment
There was a problem hiding this comment.
@CK-7vn, nice work on this one. One finding:
- The Dashboard still shows Programs with the feature off. The ticket asks for the dashboard to hide the Programs cards, but three are left:
- Today's Schedule and Missing Attendance still fetch
/api/program-classes/todays-scheduleand/missing-attendance. With Programs off, both answer 401, so Today's Schedule is empty and Missing Attendance says "All attendance up to date", which isn't true; it just couldn't load. Each 401 also sends anapi_errorevent and a session recheck. - Quick Actions only has "View All Programs" and "Browse Classes". Both pages are behind
ProgramAccess, so clicking either one just bounces the admin.
Please gate them the same way you did the others: pass null to useSWR for the two fetches when !programsEnabled, and wrap TodaysSchedule, MissingAttendanceWidget and QuickActions in programsEnabled && in both views. With all of that hidden, the page is only the header, so add a short line under it in that case, for example "Programs isn't turned on for this facility."
What has to happen before EN-245 can close:
- This PR is merged. Everything is in core, so nothing else is needed in another repo.
- On staging (core goes there on merge): turn off
program_managementfor a facility and sign in as its admin.- The Dashboard shows no Programs cards and makes no Programs calls (check the Network tab).
- Insights has no Programs tab.
GET /api/dashboard/class-metricsreturns 401 "Feature not enabled".- Then turn the feature back on and check that everything comes back.
…ement is off (EN-245) Today's Schedule, Missing Attendance and Quick Actions still rendered and fetched with the feature off, so Missing Attendance read "All attendance up to date" after a 401. Skip both fetches and show a one-line notice instead.
carddev81
left a comment
There was a problem hiding this comment.
@CK-7vn awesome!! this looks great.
What has to happen before EN-245 can close:
- This PR is merged. Everything is in core, so nothing else is needed in another repo.
- On staging (core goes there on merge): turn off
program_managementfor a facility and sign in as its admin.- The Dashboard shows only the header and the notice, and makes no Programs calls (check the Network tab).
- Insights has no Programs tab.
GET /api/dashboard/class-metricsreturns 401 "Feature not enabled".- Then turn the feature back on and check that everything comes back.
Seven admin dashboard routes returned Programs numbers even when
program_managementwas off for the facility: the five/api/department-metrics/programs/*routes,/api/dashboard/class-metricsand/api/dashboard/facility-health. EN-194 removed the feature-aware route helper, so they were registered with no feature.Ticket: EN-245
Changes
newAdminFeatureRouteinutils.goand registers the 7 routes withmodels.ProgramAccess. They now answer 401 "Feature not enabled" like other gated routes; the admin check still runs first.TestProgramsCoreRouteAccessnow pins the gate (resident: not admin; admin without the feature: 401; admin with it: allowed). Goldens are unchanged.program_management.Not changed
missing-attendanceandtodays-schedulewidgets. Those routes are served by the Programs module and already carryprogram_managementthere (Features: prog), so the server returns 401 with the feature off. The Dashboard still fetches them; skipping those fetches is a separate frontend change.